package com.training.web;

import com.training.model.City;
import com.training.service.CityClient;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping(value="/city")
public class CityController {
    @Autowired
    CityClient cityClient;

    @RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
    public String detail(Model model, @PathVariable("id") Integer id) {
    	City city = cityClient.detail(id);
        model.addAttribute("city", city);
        return "city";
    }

}